﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.Entities.Crew;
using PowerHub.MES.Entities.Equipment;
using PowerHub.MES.Entities.Log;
using PowerHub.MES.Entities.ProcessRoute;
using PowerHub.MES.Entities.Production;
using PowerHub.MES.Entities.ProductPlanning;
using PowerHub.MES.Entities.Shopfloor;

namespace PowerHub.MES.Entities;

public partial class PowerHubMesContext : DbContext
{
    public PowerHubMesContext()
    {
    }

    public PowerHubMesContext(DbContextOptions<PowerHubMesContext> options)
        : base(options)
    {
    }

    public virtual DbSet<BasicData_Department> BasicDataDepartments { get; set; }

    public virtual DbSet<BasicData_MeasuringUnit> BasicDataMeasuringUnits { get; set; }

    public virtual DbSet<BasicData_Roleinfo> BasicDataRoleinfos { get; set; }

    public virtual DbSet<BasicData_Userinfo> BasicDataUserinfos { get; set; }

    public virtual DbSet<Crew_SchedulingPlan> CrewSchedulingPlans { get; set; }

    public virtual DbSet<Crew_TeamBill> CrewTeamBills { get; set; }

    public virtual DbSet<Crew_TeamBillDetial> CrewTeamBillDetials { get; set; }

    public virtual DbSet<ProcessRoute_CraftBill> ProcessRouteCraftBills { get; set; }

    public virtual DbSet<ProcessRoute_CraftBillDetial> ProcessRouteCraftBillDetials { get; set; }

    public virtual DbSet<ProcessRoute_Process> ProcessRouteProcesses { get; set; }

    public virtual DbSet<ProductPlanning_Material> ProductPlanningMaterials { get; set; }

    public virtual DbSet<ProductPlanning_ProductBill> ProductPlanningProductBills { get; set; }

    public virtual DbSet<ProductPlanning_ProductBillDetial> ProductPlanningProductBillDetials { get; set; }

    public virtual DbSet<ProductPlanning_ProductClassify> ProductPlanningProductClassifies { get; set; }

    public virtual DbSet<Production_WorkOrder> Production_WorkOrders { get; set; }

    public virtual DbSet<Production_BillOfMaterials> Production_BillOfMaterialss { get; set; }

    public virtual DbSet<Shopfloor_Foundation> ShopfloorFoundations { get; set; }

    public virtual DbSet<Shopfloor_ProductionLine> ShopfloorProductionLines { get; set; }

    public virtual DbSet<Shopfloor_Storage> ShopfloorStorages { get; set; }

    public virtual DbSet<Shopfloor_WorkStation> ShopfloorWorkStations { get; set; }

    public virtual DbSet<Shopfloor_Workshopinfo> ShopfloorWorkshopinfos { get; set; }
    public virtual DbSet<BasicData_MenuInfo> BasicDataMenuInfo { get; set; }
    public virtual DbSet<BasicData_Roleinfo_MenuInfo> BasicDataRoleinfoMenuInfo { get; set; }
    public virtual DbSet<Crew_TeamType> CrewTeamType { get; set; }
    public virtual DbSet<Crew_SchedulingPlanDetial> CrewSchedulingPlanDetial { get; set; }
    public virtual DbSet<Production_ProductionTask> Production_ProductionTask { get; set; }
    public virtual DbSet<Equipment_EquipmentManagement> Equipment_EquipmentManagement { get; set; }
    public virtual DbSet<Equipment_EquipmentClassify> Equipment_EquipmentClassify { get; set; }
    public virtual DbSet<Log_Request> Log_Request { get; set; }


    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        modelBuilder.Entity<BasicData_Department>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__BasicDat__3214EC07955C700A");

            entity.ToTable("BasicData_Department");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.DepartmentName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.DepartmentNo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<BasicData_MeasuringUnit>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__BasicDat__3214EC075BD3A58F");

            entity.ToTable("BasicData_MeasuringUnit");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.MeasuringUnitName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.MeasuringUnitNo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<BasicData_Roleinfo>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__BasicDat__3214EC0761D65C5A");

            entity.ToTable("BasicData_Roleinfo");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.RoleNo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<BasicData_Userinfo>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__BasicDat__3214EC0745B776C7");

            entity.ToTable("BasicData_Userinfo");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.DepartmentId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.JobNumber)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.PhoneNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("PhoneNO");
            entity.Property(e => e.RoleinfoId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UserName)
                .HasMaxLength(255)
                .IsUnicode(false);

            //entity.HasOne(d => d.Department).WithMany(p => p.BasicDataUserinfos)
            //    .HasForeignKey(d => d.DepartmentId)
            //    .HasConstraintName("FK__BasicData__Depar__3E52440B");

            //entity.HasOne(d => d.Roleinfo).WithMany(p => p.BasicDataUserinfos)
            //    .HasForeignKey(d => d.RoleinfoId)
            //    .HasConstraintName("FK__BasicData__Rolei__3D5E1FD2");
        });

        modelBuilder.Entity<Crew_SchedulingPlan>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Crew_Sch__3214EC07E06B4A66");

            entity.ToTable("Crew_SchedulingPlan");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.EndTime).HasColumnType("datetime");
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.SchedulingPlanName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.SchedulingPlanNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("SchedulingPlanNO");
            entity.Property(e => e.StartTime).HasColumnType("datetime");
            entity.Property(e => e.TeamBillId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);

            //entity.HasOne(d => d.TeamBill).WithMany(p => p.CrewSchedulingPlans)
            //    .HasForeignKey(d => d.TeamBillId)
            //    .HasConstraintName("FK__Crew_Sche__TeamB__5629CD9C");
        });

        modelBuilder.Entity<Crew_TeamBill>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Crew_Tea__3214EC07BA4B72E7");

            entity.ToTable("Crew_TeamBill");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.TeamName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.TeamNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("TeamNO");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UserId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.UserIdName)
                .HasMaxLength(255)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Crew_TeamBillDetial>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Crew_Tea__3214EC07C77B73D5");

            entity.ToTable("Crew_TeamBillDetial");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.TeamId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UserId)
                .HasMaxLength(255)
                .IsUnicode(false);

            entity.HasOne(d => d.Team).WithMany(p => p.CrewTeamBillDetials)
                .HasForeignKey(d => d.TeamId)
                .HasConstraintName("FK__Crew_Team__TeamI__52593CB8");

            //entity.HasOne(d => d.User).WithMany(p => p.CrewTeamBillDetials)
            //    .HasForeignKey(d => d.UserId)
            //    .HasConstraintName("FK__Crew_Team__UserI__534D60F1");
        });

        modelBuilder.Entity<ProcessRoute_CraftBill>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProcessR__3214EC074905CA2A");

            entity.ToTable("ProcessRoute_CraftBill");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CraftBillName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CraftBillNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("CraftBillNO");
            entity.Property(e => e.CraftBillSort)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<ProcessRoute_CraftBillDetial>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProcessR__3214EC0790395E06");

            entity.ToTable("ProcessRoute_CraftBillDetial");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CraftBillId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ProcessId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);

            entity.HasOne(d => d.CraftBill).WithMany(p => p.ProcessRouteCraftBillDetials)
                .HasForeignKey(d => d.CraftBillId)
                .HasConstraintName("FK__ProcessRo__Craft__5DCAEF64");

            //entity.HasOne(d => d.Process).WithMany(p => p.ProcessRouteCraftBillDetials)
            //    .HasForeignKey(d => d.ProcessId)
            //    .HasConstraintName("FK__ProcessRo__Proce__5CD6CB2B");
        });

        modelBuilder.Entity<ProcessRoute_Process>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProcessR__3214EC077EF58F5F");

            entity.ToTable("ProcessRoute_Process");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ProcessExplain)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProcessName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProcessNo)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<ProductPlanning_Material>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProductP__3214EC074000576A");

            entity.ToTable("ProductPlanning_Materials");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.MaterialsCode)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.MaterialsName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.MeasuringUnitId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ModelNumber)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Specification)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Supplier)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<ProductPlanning_ProductBill>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProductP__3214EC0747C3E7FD");

            entity.ToTable("ProductPlanning_ProductBill");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.MeasuringUnitId)
                .HasMaxLength(255)
                .IsUnicode(false);
         
            entity.Property(e => e.ProductBillName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductClassifyId)
                .HasMaxLength(255)
                .IsUnicode(false);
         
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);

            //entity.HasOne(d => d.MeasuringUnit).WithMany(p => p.ProductPlanningProductBills)
            //    .HasForeignKey(d => d.MeasuringUnitId)
            //    .HasConstraintName("FK__ProductPl__Measu__6477ECF3");

            //entity.HasOne(d => d.ProductClassify).WithMany(p => p.ProductPlanningProductBills)
            //    .HasForeignKey(d => d.ProductClassifyId)
            //    .HasConstraintName("FK__ProductPl__Produ__656C112C");
        });

        modelBuilder.Entity<ProductPlanning_ProductBillDetial>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProductP__3214EC0739E4A727");

            entity.ToTable("ProductPlanning_ProductBillDetial");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.MaterialsId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductBillId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);

            //entity.HasOne(d => d.Materials).WithMany(p => p.ProductPlanningProductBillDetials)
            //    .HasForeignKey(d => d.MaterialsId)
            //    .HasConstraintName("FK__ProductPl__Mater__68487DD7");

            //entity.HasOne(d => d.ProductBill).WithMany(p => p.ProductPlanningProductBillDetials)
            //    .HasForeignKey(d => d.ProductBillId)
            //    .HasConstraintName("FK__ProductPl__Produ__693CA210");
        });

        modelBuilder.Entity<ProductPlanning_ProductClassify>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__ProductP__3214EC071AAE99CB");

            entity.ToTable("ProductPlanning_ProductClassify");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ParentId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductClassifyName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductClassifyNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("ProductClassifyNO");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Production_WorkOrder>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Producti__3214EC0728A9F5E6");

            entity.ToTable("Production_WorkOrder");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.BatchNumber)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.CustomerNO)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.CustomerName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.EstimatedEndDate).HasColumnType("datetime");
            entity.Property(e => e.EstimatedProductionDate).HasColumnType("datetime");
            entity.Property(e => e.ProductBillId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.WorkOrderName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.WorkOrderNO)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("WorkOrderNO");

            //entity.HasOne(d => d.ProductBill).WithMany(p => p.Production_WorkOrders)
            //    .HasForeignKey(d => d.ProductBillId)
            //    .HasConstraintName("FK__Productio__Produ__6C190EBB");
        });

        modelBuilder.Entity<Production_BillOfMaterials>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Producti__3214EC0783BB2B05");

            entity.ToTable("Production_BillOfMaterials");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Production_WorkOrderId)
                .HasMaxLength(255)
                .IsUnicode(false);

            //entity.HasOne(d => d.WorkOrderBill).WithMany(p => p.Production_BillOfMaterials)
            //    .HasForeignKey(d => d.WorkOrderBillId)
            //    .HasConstraintName("FK__Productio__WorkO__6EF57B66");
        });

        modelBuilder.Entity<Shopfloor_Foundation>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Shopfloo__3214EC070E81514B");

            entity.ToTable("Shopfloor_Foundation");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Address)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Createtime).HasColumnType("datetime");
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.FoundationName)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.FoundationNo)
                .HasMaxLength(30)
                .IsUnicode(false);
                //.HasColumnName("StorageNO");
            entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
        });

        modelBuilder.Entity<Shopfloor_ProductionLine>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Shopfloo__3214EC0763E247A9");

            entity.ToTable("Shopfloor_ProductionLine");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.PersonInCharge)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductionLineName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.ProductionLineNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("ProductionLineNO");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UserId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.WorkshopId)
                .HasMaxLength(255)
                .IsUnicode(false);

            //entity.HasOne(d => d.User).WithMany(p => p.ShopfloorProductionLines)
            //    .HasForeignKey(d => d.UserId)
            //    .HasConstraintName("FK__Shopfloor__UserI__4AB81AF0");

            //entity.HasOne(d => d.Workshop).WithMany(p => p.ShopfloorProductionLines)
            //    .HasForeignKey(d => d.WorkshopId)
            //    .HasConstraintName("FK__Shopfloor__Works__49C3F6B7");
        });

        modelBuilder.Entity<Shopfloor_Storage>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Shopfloo__3214EC07C26E7843");

            entity.ToTable("Shopfloor_Storage");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Address)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Createtime).HasColumnType("datetime");
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.FoundationId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.StorageName)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.StorageNo)
                .HasMaxLength(30)
                .IsUnicode(false)
                .HasColumnName("StorageNO");
            entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);

            entity.HasOne(d => d.Foundation).WithMany(p => p.ShopfloorStorages)
                .HasForeignKey(d => d.FoundationId)
                .OnDelete(DeleteBehavior.ClientSetNull)
                .HasConstraintName("FK__Shopfloor__Found__4316F928");
        });

        modelBuilder.Entity<Shopfloor_WorkStation>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Shopfloo__3214EC07B243379E");

            entity.ToTable("Shopfloor_WorkStation");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Address)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.ProductionLineId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.WorkStationName)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.WorkStationNo)
                .HasMaxLength(255)
                .IsUnicode(false)
                .HasColumnName("WorkStationNO");

            //entity.HasOne(d => d.ProductionLine).WithMany(p => p.ShopfloorWorkStations)
            //    .HasForeignKey(d => d.ProductionLineId)
            //    .HasConstraintName("FK__Shopfloor__Produ__4D94879B");
        });

        modelBuilder.Entity<Shopfloor_Workshopinfo>(entity =>
        {
            entity.HasKey(e => e.Id).HasName("PK__Shopfloo__3214EC079A95F8AB");

            entity.ToTable("Shopfloor_Workshopinfo");

            entity.Property(e => e.Id)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.Area)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.Createtime).HasColumnType("datetime");
            entity.Property(e => e.Creator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.FoundationId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.UpdateDate).HasColumnType("datetime");
            entity.Property(e => e.Updator)
                .HasMaxLength(50)
                .IsUnicode(false);
            entity.Property(e => e.UserId)
                .HasMaxLength(255)
                .IsUnicode(false);
            entity.Property(e => e.WorkshopName)
                .HasMaxLength(30)
                .IsUnicode(false);
            entity.Property(e => e.WorkshopNo)
                .HasMaxLength(30)
                .IsUnicode(false)
                .HasColumnName("WorkshopNO");

            //entity.HasOne(d => d.Storage).WithMany(p => p.ShopfloorWorkshopinfos)
            //    .HasForeignKey(d => d.StorageId)
            //    .HasConstraintName("FK__Shopfloor__Stora__46E78A0C");

            //entity.HasOne(d => d.User).WithMany(p => p.ShopfloorWorkshopinfos)
            //    .HasForeignKey(d => d.UserId)
            //    .HasConstraintName("FK__Shopfloor__UserI__45F365D3");
        });

        OnModelCreatingPartial(modelBuilder);
    }

    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
